package com.yaozheng.vocationaltraining.view;

import net.sf.json.JSONObject;

import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

import com.yaozheng.vocationaltraining.R;
import com.yaozheng.vocationaltraining.utils.BitmapLoader;
import com.yaozheng.vocationaltraining.utils.TypeUtils;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * 一项维保保养
 *
 * @author xiaoqing
 */
@EViewGroup(R.layout.item_maintenance_encyclopedia)
public class MaintenanceEncyclopediaItemView extends LinearLayout {
    @ViewById
    ImageView newsContentImage;
    @ViewById
    TextView newsContentText;


    public MaintenanceEncyclopediaItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
    }

    public MaintenanceEncyclopediaItemView(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
    }

    public void loadData(JSONObject itemJsonObject, int position,
                         BitmapLoader bitmapLoader) {
        newsContentText.setText(TypeUtils.getJsonString(itemJsonObject,
                "subject"));
        // ImageLoader.getInstance().displayImage(
        // TypeUtils.getJsonString(itemJsonObject, "image"),
        // newsContentImage, displayImageOptions);
        bitmapLoader.displayImage(
                TypeUtils.getJsonString(itemJsonObject, "image"),
                newsContentImage);
    }
}
